<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>v-bind动态绑定属性</title>
  </head>
  <body>
    <div id="app">
      <!-- 1、绑定变量 -->
      <h1 :title="titleVal">我是h1标签</h1>
      <div class="img-box">
        <img :src="imgURL" width="400" height="200" />
      </div>

      <!-- 2、绑定计算属性 -->
      <input type="text" :value="inputVal" />

      <!-- 3、绑定方法 -->
      <input type="text" :value="inputVal2()" />
    </div>

    <script src="./lib/vue_v2.6.14.js"></script>
    <script>
      const app = new Vue({
        el: '#app',
        computed: {
          inputVal() {
            return '越努力越幸运!';
          }
        },
        data: {
          titleVal: 'hello world',
          imgURL:
            'https://youjia-image.cdn.bcebos.com/modelImage/bd49fe5b8a244d1b956777a1293f273c/16196806057173266694.jpg@!watermark_1'
        },
        methods: {
          inputVal2() {
            return '天道酬勤';
          }
        }
      });
    </script>
  </body>
</html>
